//
//  ClassC.m
//  MultipleInheritanceDemo
//
//  Created by apple on 2018/1/3.
//  Copyright © 2018年 WJ. All rights reserved.
//

#import "ClassC.h"
#import "ClassA.h"
#import "ClassB.h"

#import <objc/runtime.h>


static const char *walkDistanceKey = "walkDistanceKey";
static const char *runDistanceKey = "runDistanceKey";
@interface ClassC()<ClassADelegate,ClassBDelegate>

@end

@implementation ClassC
@synthesize walkDistance;
@synthesize runDistance;

- (void)sport{
    [self run];
    [self walk];
}

- (void)run{
    self.runDistance = @"10000";
    NSLog(@"今天跑了%@步",self.runDistance);
}
- (void)walk{
    self.walkDistance = @"5000";
    NSLog(@"今天走了%@步",self.walkDistance);
}

- (void)setWalkDistance:(NSString *)walkDistance{
    objc_setAssociatedObject(self, &walkDistanceKey, walkDistance, OBJC_ASSOCIATION_COPY_NONATOMIC);
}
- (void)setRunDistance:(NSString *)runDistance{
    objc_setAssociatedObject(self, &runDistanceKey, runDistance, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

- (NSString *)walkDistance{
    return objc_getAssociatedObject(self, &walkDistanceKey);
}
- (NSString *)runDistance{
    return objc_getAssociatedObject(self, &runDistanceKey);
}

@end
